package com.sun.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.BooleanEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Project: hospitalDrugInformationManagement
 * @Author: 86178
 * @Date: 2023/2/15 10:01
 * @FileName: drug
 * @Description: "药品实体类"
 */
@EqualsAndHashCode
@Data
@SuppressWarnings("all")
@AllArgsConstructor
@NoArgsConstructor
//普通单元格的高度
@ContentRowHeight(42)
//头部单元格的高度
@HeadRowHeight(30)
//普通单元格的字体大小
@ContentFontStyle(fontHeightInPoints = 10)
public class Drug extends Model<Drug> {
    /**
     * 编号
     */
//    避免科学计数法
//    @NumberFormat(value = "#")
//    设置单元格水平和垂直
//    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
//   设置单元格宽度
//    @ColumnWidth(30)
// 转换器设置为long和string的转换防止精度丢失
//    @ExcelProperty(value = "Id", index = 0, converter = LongStringConverter.class)
    @ExcelIgnore
    @TableId()
    private Long drugId;
    /**
     * 药品名称
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(20)
    @ExcelProperty("药品名称")
    private String drugName;
    /**
     * 药品代码
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(20)
    @ExcelProperty("药品代码")
    private String drugCode;
    /**
     * 药品图片
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(20)
    @ExcelProperty("药品图片")
    private String image;
    /**
     * 用法用量
     */
    @ContentStyle(wrapped = BooleanEnum.TRUE, horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.TOP)
    @ColumnWidth(30)
    @ContentFontStyle(fontHeightInPoints = 8)
    @ExcelProperty("用法用量")
    private String dosage;
    /**
     * 不良反应
     */
    @ContentStyle(wrapped = BooleanEnum.TRUE, horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.TOP)
    @ColumnWidth(30)
    @ContentFontStyle(fontHeightInPoints = 8)
    @ExcelProperty("不良反应")
    private String reactions;
    /**
     * 禁忌及注意事项
     */
    @ContentStyle(wrapped = BooleanEnum.TRUE, horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.TOP)
    @ColumnWidth(35)
    @ContentFontStyle(fontHeightInPoints = 8)
    @ExcelProperty(value = "禁忌及注意事项", index = 13)
    private String taboo;
    /**
     * 成份
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(25)
    @ExcelProperty("成份")
    private String composition;
    /**
     * 药品分类id
     */
    @ExcelIgnore
    private Long categoryId;
    /**
     * 描述信息，适应症状
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.TOP, wrapped = BooleanEnum.TRUE)
    @ColumnWidth(40)
    @ContentFontStyle(fontHeightInPoints = 8)
    @ExcelProperty("适用症状")
    private String description;
    /**
     * 0 停售 1 起售
     */
    @ExcelIgnore
    private Integer status;
    /**
     * 规格
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.TOP, wrapped = BooleanEnum.TRUE)
    @ColumnWidth(25)
    @ContentFontStyle(fontHeightInPoints = 8)
    @ExcelProperty("规格")
    private String standard;
    /**
     * 剂型
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(25)
    @ContentFontStyle(fontHeightInPoints = 10)
    @ExcelProperty("剂型")
    private String type;
    /**
     * 有效期  单位/天
     */
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(8)
    @ExcelProperty("有效期")
    private String validityPeriod;
//    /**
//     * 厂商id
//     */
//    @ExcelIgnore
//    private Long supplierId;
    /**
     * 创建时间
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    /**
     * 修改时间
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     * 创建人
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;
    /**
     * 修改人
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    /**
     * 库存下限
     */
    @ExcelIgnore
    private Integer lowerlimit;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.drugId;
    }
}
